import request from "@/utils/request.js";

/**
 * 提交人设描述
 */
export function sendCharacterPrompt(uuid, message) {
    const data = {
        uuid,
        message
    }
    return request({
        url: '/chat/simulator/characterDesc',
        method: 'post',
        data: data
    })
}

/**
 * 获取人设描述记录
 */
export function getCharacterPrompt(userId) {
    return request({
        url: '/chat/simulator/promptHistory?userId=' + userId,
        method: 'get',
    })
}

/**
 * 根据id删除人设描述记录
 */
export function delPromptById(id, userId) {
    return request({
        url: '/chat/simulator/delPrompt?id=' + id + '&userId=' + userId ,
        method: 'delete',
    })
}

/**
 * 获取人设id
 */
export function getPersonalityId(userId) {
    return request({
        url: '/chat/simulator/personalityId?userId=' + userId ,
        method: 'get',
    })
}

/**
 * 查询人设信息
 */
export function getPersonality(id, userId) {
    return request({
        url: '/chat/simulator/personality?id=' + id + '&userId=' + userId ,
        method: 'get',
    })
}

/**
 * 根据id删除人设
 */
export function delPersonality(id, userId) {
    return request({
        url: '/chat/simulator/delPersonality?id=' + id + '&userId=' + userId ,
        method: 'delete',
    })
}

/**
 * 提交对话信息
 */
export function sendChatMessage(uuid, message) {
    const data = {
        uuid,
        message
    }
    return request({
        url: '/chat/sse/constantChat',
        method: 'post',
        data: data
    })
}

/**
 * 获取对话记录
 */
export function getChatHistory(userId) {
    return request({
        url: '/chat/simulator/chatHistory?userId=' + userId  ,
        method: 'get',
    })
}

/**
 * 根据userId删除对话记录
 */
export function delChatHistory(userId) {
    return request({
        url: '/chat/simulator/delChatHistory?userId=' + userId ,
        method: 'delete',
    })
}

/**
 * 重构人设
 */
export function rebuildPersonality(id, userId) {
    return request({
        url: '/chat/simulator/rebuild?id=' + id + '&userId=' + userId ,
        method: 'post',
    })
}
